package com.beauty.dressing.module.market.holder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.beauty.dressing.R;
import com.beauty.dressing.common.base.BaseRecyclerViewHolder;
import com.beauty.dressing.common.bean.BaseBean;
import com.facebook.drawee.view.SimpleDraweeView;
import com.framework.common.utils.IDisplayUtil;
import com.xiaolanba.commonlib.fresco.FrescoUtil;

/**
 * @author xutingz
 * @E-mail xutz@xianlanba.com
 * @date 2018/05/03
 */

public class DetailImgHolder extends BaseRecyclerViewHolder<BaseBean> {

    private SimpleDraweeView mImage;
    private View mRoot;
    public DetailImgHolder(Context context, LayoutInflater inflater, ViewGroup viewGroup) {
        super(R.layout.detail_img_holder, context, inflater, viewGroup);
    }

    @Override
    public void findView() {
        mImage = (SimpleDraweeView) itemView.findViewById(R.id.image);
        mRoot = itemView.findViewById(R.id.root_layout);
        int screenW = IDisplayUtil.getScreenWidth(mContext);
        int width =  (screenW-IDisplayUtil.dip2px(mContext,48+9))/2;
//        mRoot.getLayoutParams().width = screenW/2;
        mImage.getLayoutParams().width = width;
        mImage.getLayoutParams().height = (int) (width*1.2f);

    }

    @Override
    public void bindData(BaseBean bean, int position) {
        FrescoUtil.loadImage(mImage,position%2==0?"http://images.9zhitx.com/67703eeb-6445-46af-9cba-4b8239e1f32f.jpg":"http://images.9zhitx.com/5beb85bd-7533-4b8a-bf70-19c84006cb84.jpg");
    }


    @Override
    public void onItemClick(BaseBean bean, int position) {

    }
}
